import request from "../../services/index"
import { IResponse, ProductInfoResult, ProductListResult, UserBuyRecordResult } from "../../types/common";
import { ProductInfoParams, ProductListParams, ProductBuyRecordParams } from "../../types/product"

// 获取产品详情
export async function getProductInfo(params: ProductInfoParams) {
    return request.get<IResponse<ProductInfoResult>>('/api/prod/info', params);
}
// 获取产品列表
export async function getProductList(params: ProductListParams) {
    return request.get<IResponse<ProductListResult>>('/api/prod/list', params);
}
// 产品购买记录
export async function getProductBuyListApi(params: ProductBuyRecordParams) {
    return request.get<IResponse<UserBuyRecordResult>>('/api/user/shop_record', params);
}
// 更新产品信息
export async function updateProductInfoApi(params: ProductInfoParams) {
    return request.post<IResponse<ProductInfoResult>>('/api/prod/update', params);
}
// 上传商品多张图片
export async function uploadProductImgApi(params: ProductInfoParams) {
    return request.post<IResponse<string>>('/api/prod/upload', params);
}